package xinxin.com.CompositePatternBasic.Component.Leaf;

import xinxin.com.CompositePatternBasic.Component.Component;

public class Leaf extends Component {
    public Leaf(String name) {
        super(name);
    }

    @Override
    public void Add(Component component) {
        System.out.println("不能添加分支");
    }

    @Override
    public void Remove(Component component) {
        System.out.println("不能移除分支");
    }

    @Override
    public void Display(int depth) {
        for (int i = 0; i < depth; i++) {
            System.out.print(' ');
        }
        System.out.println('-' + name);
    }
}
